import torch

from algorithms.base.nsga2 import NSGA2
from indicators import Indicator


class GD(Indicator):
    @classmethod
    def value(cls, pop_obj, pf):
        pop_obj = NSGA2.get_best(pop_obj)
        return torch.cdist(pop_obj, pf).min(1)[0].mean()
